/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package conexionBaseDatos;

/**
 *
 * @author David Vallejos A
 */
import java.sql.*;
import javax.swing.JOptionPane;

public class TestConnection {

    public String bd = "veterinaria";
    public String login = "root";
    public String password = "tata3081";
    public String url = "jdbc:mysql://localhost/" + bd;
    private Statement stm;
    private ResultSet rs;

    public void conectar() {
        Connection conn = null;
        try {
            Class.forName("org.gjt.mm.mysql.Driver");
            conn = DriverManager.getConnection(url, login, password);
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException ex) {

            JOptionPane.showMessageDialog(null, "Hubo un problema al intentar conectarse con la base de datos " + url);
        } catch (ClassNotFoundException ex) {
            System.out.println(ex);
        }
    }
}
